<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Transaction filter form base class.
 *
 * @package    wifilez
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseTransactionFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'invoice_id'            => new sfWidgetFormPropelChoice(array('model' => 'Invoice', 'add_empty' => true)),
      'card_number'           => new sfWidgetFormFilterInput(),
      'card_exp_month'        => new sfWidgetFormFilterInput(),
      'card_exp_year'         => new sfWidgetFormFilterInput(),
      'card_type'             => new sfWidgetFormFilterInput(),
      'payment_type'          => new sfWidgetFormFilterInput(),
      'trans_amount'          => new sfWidgetFormFilterInput(),
      'status'                => new sfWidgetFormFilterInput(),
      'current_auth_response' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'invoice_id'            => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Invoice', 'column' => 'invoice_id')),
      'card_number'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'card_exp_month'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'card_exp_year'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'card_type'             => new sfValidatorPass(array('required' => false)),
      'payment_type'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'trans_amount'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'status'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'current_auth_response' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('transaction_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Transaction';
  }

  public function getFields()
  {
    return array(
      'transaction_id'        => 'Number',
      'invoice_id'            => 'ForeignKey',
      'card_number'           => 'Number',
      'card_exp_month'        => 'Number',
      'card_exp_year'         => 'Number',
      'card_type'             => 'Text',
      'payment_type'          => 'Number',
      'trans_amount'          => 'Number',
      'status'                => 'Number',
      'current_auth_response' => 'Text',
    );
  }
}
